Skip to content

feat(rbx_auth): check csrf token per request#228

Merged
blake-mealey merged 7 commits intomainfrom
blake/rbx-auth-request-factory
Mar 4, 2025
Merged

feat(rbx_auth): check csrf token per request#228
blake-mealey merged 7 commits intomainfrom
blake/rbx-auth-request-factory

Conversation

@blake-mealey
Copy link
Owner

Instead of fetching the CSRF token a single time and caching it in the RobloxAuth struct, we implement a middleware-esque approach where we pass as request factory closure to a custom CsrfTokenStore.send_request function which will call the factory to construct the request, send the request, then extract the CSRF token from the response headers and resend if necessary.

This approach correctly resolves #226 by no longer relying on a deprecated method of receiving a CSRF token.

Additionally, it resolves a long-standing issue of rbx_auth/rbx_api when used in a long-running context where the CSRF token expires. Now, the token will be automatically refreshed and the request retried.

This change does change the public API of both rbx_auth and rbx_api in a very large way, so this PR should not be merged until the docs have been updated as well.

@vercel
Copy link

vercel bot commented Oct 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mantle-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 4, 2025 3:28am

@blake-mealey blake-mealey marked this pull request as draft October 20, 2024 22:45
@blake-mealey blake-mealey marked this pull request as ready for review March 4, 2025 02:53
@blake-mealey blake-mealey merged commit 9d1d249 into main Mar 4, 2025
4 checks passed
@blake-mealey blake-mealey deleted the blake/rbx-auth-request-factory branch March 4, 2025 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request for CSRF token did not return an X-CSRF-Token header

1 participant